import 'dart:convert';

import 'package:flutterproject/generated/json/base/json_field.dart';
import 'package:flutterproject/generated/json/product_bean.g.dart';

@JsonSerializable()
class ProductBean {
  List<ProductBanners>? banners;
  List<ProductProducts>? products;

  ProductBean();

  factory ProductBean.fromJson(Map<String, dynamic> json) =>
      $ProductBeanFromJson(json);

  Map<String, dynamic> toJson() => $ProductBeanToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class ProductBanners {
  int? createTime;
  String? flag;
  int? id;
  String? imageUrl;
  String? lang;
  int? state;
  String? targetUrl;
  String? title;
  int? updateTime;

  ProductBanners();

  factory ProductBanners.fromJson(Map<String, dynamic> json) =>
      $ProductBannersFromJson(json);

  Map<String, dynamic> toJson() => $ProductBannersToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class ProductProducts {
  String? description;
  int? id;
  String? mainImage;
  int? price;
  int? stock;
  String? title;

  ProductProducts();

  factory ProductProducts.fromJson(Map<String, dynamic> json) =>
      $ProductProductsFromJson(json);

  Map<String, dynamic> toJson() => $ProductProductsToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}
